<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <title>第十一课 引用类型（数组2）</title>
</head> 
<body>
    <script>
        // var arr = [100,200,300,400,500];
        // var push1 = arr.push(1000);
        // console.log(push1);//6
        // var pop1 = arr.pop();
        // console.log(pop1);//500
        // var unshift1 = arr.unshift(10);
        // console.log(unshift1);//6
        // var shift1 = arr.shift();
        // console.log(shift1);//100
        // console.log(arr);//[100, 200, 300, 400, 500, 1000]
        // var arr = [2,30,100,1,6,9,11,200,33];
        // console.log(arr.sort(compare));
        // function compare(value1,value2){
        //     if(value1 < value2){
        //         return -1;
        //     }else if(value1 > value2){
        //         return 1;
        //     }else{
        //         return 0;
        //     }
        // }
        // console.log(arr);
        // var arr = [1,2,3,4,5,6,7,8,9];
        // console.log(arr.reverse());//(9) [9, 8, 7, 6, 5, 4, 3, 2, 1]
        // console.log(arr);

        // var arr1 = [3,6,1,33,63,93,11,23,19];
        // function quickSort(arr){
        //     if(arr.length < 1){
        //         return arr;
        //     }
        //     let centerIndex = Math.floor(arr.length / 2);
        //     let centerNum = arr.splice(centerIndex,1)[0];
        //     let left = [];
        //     let right = [];
        //     for(let i=0;i<arr.length;i++){
        //         if(arr[i] < centerNum){
        //             left.push(arr[i])
        //         }else{
        //             right.push(arr[i])
        //         }
        //     }
        //     return quickSort(left).concat([centerNum],quickSort(right));
        // }
        // console.log(quickSort(arr1));

        // let arr = [1,2,3,4,5,6];
        // let num = arr.reduce((prev,item) => {
        //     return prev + item;
        // },0);
        // console.log(num);

    </script>
</body> 
</html>